package com.fub.util.database.databaseHelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class AccessPointsDatabaseManager extends SQLiteOpenHelper {

	public static final String TABLE_NAME_ACCESS_POINTS = "access_points";
	public static final String COL_ID = "_id";
	public static final String BUILDING_ID_COL = "building_id";
	public static final String COL_LOCATION_ID = "location_id";
	public static final String COL_SSID = "ssid";
	public static final String COL_SS = "ss";

	private static final String DATABASE_NAME = "access_points.db";
	private static final int Version = 1;
	private static final String CREATE_TABLE_ACCESS_POINTS = String
			.format("create table %s (%s text not null, %s text not null, %s text not null, %s text not null);",
					TABLE_NAME_ACCESS_POINTS, BUILDING_ID_COL, COL_LOCATION_ID,
					COL_SSID, COL_SS);

	public AccessPointsDatabaseManager(Context context) {
		super(context, DATABASE_NAME, null, Version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_ACCESS_POINTS);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_ACCESS_POINTS);
		onCreate(db);
	}
}
